package MapDemo.TreeMapdemo.demo1;

import java.security.KeyStore.Entry;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;


public class test {
    public static void main(String[] args){
        // 创建四个学生对象
        Student s1 = new Student("zhangsan",29);
        Student s2 = new Student("lisi",30);
        Student s3 = new Student("wangwu",12);
        Student s4 = new Student("zhangsan",29);

        // 创建集合对象
        TreeMap<Student,String> tm = new TreeMap<>();
        
        // 添加元素
        tm.put(s1,"立管");
        tm.put(s2,"南京");
        tm.put(s3,"深圳");
        tm.put(s4,"北京");

        Set<Student> s = tm.keySet();
        for (Student s5 : s) {
            s5.show();
        }
        
    }
}
